package cn.xuguowen.user.designPatten.factory.customer_abstract_factory;

/**
 * ClassName: Client
 * Package: cn.xuguowen.user.designPatten.factory.customer_abstract_factory
 * Description:
 * 客户端
 * @Author 徐国文
 * @Create 2023/4/27 14:49
 * @Version 1.0
 */
public class Client {

    public static void main(String[] args) {
        // 获取形状工厂对象
        AbstractFactory shapeFactory = FactoryProducer.getFactory("SHAPE");

        Shape circle = shapeFactory.getShape("CIRCLE");
        circle.draw();

        Shape rectangle = shapeFactory.getShape("RECTANGLE");
        rectangle.draw();

        Shape square = shapeFactory.getShape("SQUARE");
        square.draw();

        // 获取颜色工厂对象
        AbstractFactory colorFactory = FactoryProducer.getFactory("COLOR");

        Color red = colorFactory.getColor("RED");
        red.fill();

        Color green = colorFactory.getColor("GREEN");
        green.fill();

        Color blue = colorFactory.getColor("BLUE");
        blue.fill();
    }

}
